<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="app">
<comp :cmessage="message" :clist="list"></comp>
<comp :clist="list"></comp>
</div>

<template id="comp">
    <div>
        <h1>Hello World  你好 {{cmessage}}</h1>
        <ul>
            <li v-for="item in clist">{{item}}</li>
        </ul>
    </div>
</template>
<script>
    // 全局组件注册
    Vue.component('comp',{
        template:'#comp',
        data: function () {
            return{

            }
        },
        // 数组传值
        // props:['cmessage','clist']
        // 对象传值
        props:{
            cmessage: {
                type:String, //类型
                default:'Hello World', //默认值
                required:true   //必须传值
            },
            clist:{
                type: Array,
                default: []
            }
        }
    })
    let vm = new Vue({
        el:'#app',
        data:{
            message:'丽丽',
            list:['111','222','333']
        }
    })
</script>
</body>
</html>
